﻿@page "/counter"
@using BlazorWebAssemblyDemo.Authentication
@using Microsoft.AspNetCore.Components.Authorization
@using SharedClassLibrary.HttpRequest

@inject ApiClient apiClient
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject IServiceProvider serviceProvider


<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<p role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
    private int currentCount = 0;

    private async Task IncrementCount()
    {
        var customAuthenticationStateProvider = AuthenticationStateProvider as JwtAuthenticationStateProvider;
        var token = customAuthenticationStateProvider.TokenInLocalStorage;
        var client = await apiClient.GetAsync();
        currentCount++;
    }
}
